package com.wxy;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
* 1.RabbitMQ:
* 1.在配置文件中添加注解开启WorkQueue
* 2.消息的发送以及接收
* 3.使用bean的方式创建queue,exchange以及绑定
* 4.使用注解方式创建并绑定
* 5.添加jackson依赖配置消息转换器
 * 2.文件上传
 * 3.R类型数据交互
 * 4.图片类型数据的交互
 * @author 47868
 */
@MapperScan("com.wxy.dao")
@SpringBootApplication
public class SpringbootDemo1Application {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootDemo1Application.class, args);
    }
    /**
     * rabbitMQ消息转换器的配置
     */
    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }

    /**
     * elasticsearch创建连接
     */
    @Bean
    public RestHighLevelClient client() {
        return new RestHighLevelClient(RestClient.builder(HttpHost.create("http://localhost:9200")));
    }
}
